package com.example.anyong17_julnumgi;

import java.util.ArrayList;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class MenuActivity extends Activity {
        ArrayList<Record>arRecord = new ArrayList<Record>();
        Button char1;
        Button jul1;
        int char_sel;
        int jul_sel;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.menuactivity);
                
                char1=(Button) findViewById(R.id.menu_btn05);
                jul1=(Button) findViewById(R.id.menu_btn06);
        
                SharedPreferences pref = getSharedPreferences("JUL", 0);//sensor설정
                char_sel=pref.getInt("cal_selec", 1);
                jul_sel=pref.getInt("jul_selec", 1);
                
                if(char_sel<=1)char1.setBackgroundResource(R.drawable.rabit1_ico);
                if(char_sel==2)char1.setBackgroundResource(R.drawable.tutle1_ico);
                if(char_sel==3)char1.setBackgroundResource(R.drawable.rion1_ico);
                if(char_sel==4)char1.setBackgroundResource(R.drawable.man1_ico);
                if(char_sel==5)char1.setBackgroundResource(R.drawable.army1_ico);
                if(char_sel==6)char1.setBackgroundResource(R.drawable.suq1_ico);
                if(char_sel==7)char1.setBackgroundResource(R.drawable.dars1_ico);
                if(char_sel==8)char1.setBackgroundResource(R.drawable.enter1_ico);
                
                if(jul_sel<=1)jul1.setBackgroundResource(R.drawable.wood1_ico);
                if(jul_sel==2)jul1.setBackgroundResource(R.drawable.plastic1_ico);
                if(jul_sel==3)jul1.setBackgroundResource(R.drawable.leep1_ico);
                if(jul_sel==4)jul1.setBackgroundResource(R.drawable.heavy1_ico);
                if(jul_sel==5)jul1.setBackgroundResource(R.drawable.gun1_ico);
                if(jul_sel==6)jul1.setBackgroundResource(R.drawable.whip1_ico);
                if(jul_sel==7)jul1.setBackgroundResource(R.drawable.sword1_ico);
                if(jul_sel==8)jul1.setBackgroundResource(R.drawable.mic1_ico);
        
                
        }
        public void mOnClick(View v){
                
                
                switch(v.getId()){
                        
                        case R.id.menu_btn01://JUL
                                startActivity(new Intent(this, JUL_Activity.class));
                                break;
                        case R.id.menu_btn02://time set
                                startActivity(new Intent(this, TimeSetActivity.class));
                                break;
                        case R.id.menu_btn03://record
                                Intent intent= new Intent(this, RecordActivity.class);
                                intent.putParcelableArrayListExtra("Recoders", arRecord);
                                startActivity(intent);
                                break;
                        case R.id.menu_btn04://도움말
                                finish();
                                break;
                        case R.id.menu_btn05:
                        case R.id.menu_btn06:
                                startActivity(new Intent(this, CharterActivity.class));
                                break;
                                
                }
        }
       
        @Override
        protected void onRestart() {
        // TODO Auto-generated method stub
        super.onRestart();
        SharedPreferences pref = getSharedPreferences("JUL", 0);//sensor설정
        char_sel=pref.getInt("cal_selec", 1);
        jul_sel=pref.getInt("jul_selec", 1);
        
        if(char_sel<=1)char1.setBackgroundResource(R.drawable.rabit1_ico);
        if(char_sel==2)char1.setBackgroundResource(R.drawable.tutle1_ico);
        if(char_sel==3)char1.setBackgroundResource(R.drawable.rion1_ico);
        if(char_sel==4)char1.setBackgroundResource(R.drawable.man1_ico);
        if(char_sel==5)char1.setBackgroundResource(R.drawable.army1_ico);
        if(char_sel==6)char1.setBackgroundResource(R.drawable.suq1_ico);
        if(char_sel==7)char1.setBackgroundResource(R.drawable.dars1_ico);
        if(char_sel==8)char1.setBackgroundResource(R.drawable.enter1_ico);
 
        if(jul_sel<=1)jul1.setBackgroundResource(R.drawable.wood1_ico);
        if(jul_sel==2)jul1.setBackgroundResource(R.drawable.plastic1_ico);
        if(jul_sel==3)jul1.setBackgroundResource(R.drawable.leep1_ico);
        if(jul_sel==4)jul1.setBackgroundResource(R.drawable.heavy1_ico);
        if(jul_sel==5)jul1.setBackgroundResource(R.drawable.gun1_ico);
        if(jul_sel==6)jul1.setBackgroundResource(R.drawable.whip1_ico);
        if(jul_sel==7)jul1.setBackgroundResource(R.drawable.sword1_ico);
        if(jul_sel==8)jul1.setBackgroundResource(R.drawable.mic1_ico);
        }

        @Override
        protected void onDestroy() {
        	 RecycleUtils.recursiveRecycle(getWindow().getDecorView());
             System.gc();
             super.onDestroy();
        }
}